﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:delay="clr-namespace:Delay;assembly=PhonePerformance"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:it="clr-namespace:ImageTools.Controls;assembly=ImageTools.Controls" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    Foreground="LightGray"
    x:Class="WeiboPlus.Shell.Views.StatusDetailView"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    SupportedOrientations="PortraitOrLandscape"
    d:DataContext="{d:DesignData /SampleData/StatusDetailViewModelSampleData.xaml}"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False" Orientation="Portrait">
    <phone:PhoneApplicationPage.Resources>
        <it:ImageConverter x:Key="ImageConverter" />
    </phone:PhoneApplicationPage.Resources>
    <!--LayoutRoot is the root grid where all page content is placed-->

    <Grid x:Name="LayoutRoot" Background="{StaticResource BackroundBrush}" >
        <Rectangle Style="{StaticResource SpliterStyle}" />
        <!--<Border Grid.RowSpan="2" Margin="0,140,0,0"  Background="{StaticResource BorderContainerBrush2}" BorderBrush="#FF413B3B"/>-->
        <Path VerticalAlignment="Top" Data="M20,20 L0,40 L40,40 Z" Fill="{StaticResource BorderContainerBrush1}" Margin="48,100,0,0"/>
        <toolkit:PerformanceProgressBar x:Name="progressIndicator" IsIndeterminate="{Binding Loading}" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>
        <controls:Pivot x:Name="pivot" Margin="0,0,0,70" Foreground="LightGray" SelectedIndex="{Binding PivotSelectedIndex, Mode=TwoWay}">
            <controls:PivotItem Margin="0,10,0,0">
                <controls:PivotItem.Header>
                    <Grid Width="440" Margin="-10,-10,-10,0">
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="2" >
                            <Image toolkit:TiltEffect.IsTiltEnabled="True" VerticalAlignment="Top" Margin="8,14" Height="80" Width="80"
                                    Tap="OnTapToUserHome" delay:LowProfileImageLoader.UriSource="{Binding FaceImageUri}"
                                    Source="{Binding FaceImageSource, Mode=TwoWay}">
                                <Image.Clip>
                                    <RectangleGeometry RadiusX="2" RadiusY="2" Rect="0,0,80,80"/>
                                </Image.Clip>
                            </Image>
                            <TextBlock toolkit:TiltEffect.IsTiltEnabled="True" FontSize="26" Margin="0,8,0,12" VerticalAlignment="Top" Text="{Binding Item.User.Name}" Foreground="{StaticResource PhoneAccentBrush}"/>
                            <Image Margin="0,16,0,12" Height="24" Visibility="{Binding Item.User.Verified, Converter={StaticResource BoolToVisibilityConverter}}" Width="24" Source="/Icons/verify_icon.png" VerticalAlignment="Top"/>
                        </StackPanel>
                        <TextBlock Text="{Binding Item.User.Description}" MaxHeight="70" TextWrapping="Wrap" FontSize="16" Foreground="Gray" Margin="100,45,0,0"/>
                    </Grid>
                </controls:PivotItem.Header>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <ScrollViewer x:Name="sv" Margin="2,16,2,0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                        <Grid Margin="2">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <WeiboText Foreground="LightGray" Grid.Row="1" FontSize="24"  Margin="6,6" TextWrapping="Wrap" Text="{Binding Item.Text}" />
                            <it:AnimatedImage  HorizontalAlignment="Left" Margin="12" Grid.Row="2" MaxHeight="1800" Source="{Binding ExtendedImage,Mode=TwoWay}">
                                <!--<it:AnimatedImage.Filter>
                        <itFilter:Inverter />
                    </it:AnimatedImage.Filter><Image x:Name="Image"
                                    delay:LowProfileImageLoader.UriSource="{Binding Image}" Source="{Binding ImageSource, Mode=TwoWay}"> </Image>-->
                                <toolkit:ContextMenuService.ContextMenu>
                                    <toolkit:ContextMenu>
                                        <toolkit:MenuItem Header="Save..." Command="{Binding SaveImageCommand}" CommandParameter="Image" />
                                        <!--<toolkit:MenuItem Header="Save As Wallpaper" Command="{Binding SaveImageAsWallpaperCommand}"
                                                    CommandParameter="Image" />-->
                                    </toolkit:ContextMenu>
                                </toolkit:ContextMenuService.ContextMenu>
                            </it:AnimatedImage>




                            <Border Visibility="{Binding HasRetweet, Converter={StaticResource BoolToVisibilityConverter}}" Grid.Row="2" Style="{StaticResource StatusDetailRetwiteBorderStyle}">

                                <Path VerticalAlignment="Top" Data="M10,10 L0,20 L20,20 Z" Fill="{StaticResource BorderContainerBrush1}" Margin="26,-20,-8,4"/>

                            </Border>
                            <Grid Style="{StaticResource StatusDetailRetwiteGridStyle}" Visibility="{Binding HasRetweet, Converter={StaticResource BoolToVisibilityConverter}}" Grid.Row="2" >
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="Auto"/>

                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock x:Name="tbRetUserName" Tap="tbRetUserName_Tap" Text="{Binding Item.RetweetedStatus.User.Name}" FontSize="24" Foreground="{StaticResource PhoneAccentBrush}"/>
                                    <Image VerticalAlignment="Top" Margin="2,6,0,0" Visibility="{Binding Item.RetweetedStatus.User.Verified, Converter={StaticResource BoolToVisibilityConverter}}" Width="18" Source="/Icons/verify_icon.png"/>
                                </StackPanel>
                                <WeiboText Margin="-4,4" FontSize="24"  Tap="TextBlock_Tap" Foreground="LightGray"  Grid.Row="1" Text="{Binding Item.RetweetedStatus.Text}" TextWrapping="Wrap"/>
                                <it:AnimatedImage x:Name="RetweetImage" Grid.Row="2" Margin="2" HorizontalAlignment="Left" MaxHeight="1800"
                                        Source="{Binding ExtendedReImage, Mode=TwoWay}">
                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu>
                                            <toolkit:MenuItem Header="Save..." Command="{Binding SaveImageCommand}" CommandParameter="RetweetImage" />
                                            <!--<toolkit:MenuItem Header="Save As Wallpaper" Command="{Binding SaveImageAsWallpaperCommand}"
                                                    CommandParameter="RetweetImage" />-->
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>
                                </it:AnimatedImage>

                            </Grid>
                        </Grid>
                    </ScrollViewer>

                    <TextBox x:Name="tbRepost" Text="{Binding RepostText, Mode=TwoWay}" Margin="0,0,10,0" Grid.Row="1" Style="{StaticResource TextBoxStyle3}"/>
                </Grid>

            </controls:PivotItem>
            <controls:PivotItem Margin="0,14,0,0">
                <controls:PivotItem.Header>
                    <TextBlock Margin="-10,40,0,0" Text="{Binding CommentText, Source={StaticResource AppResx}}" VerticalAlignment="Bottom"  FontSize="48" />
                </controls:PivotItem.Header>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <ListBox Margin="2,12,2,0" x:Name="commentsList" ItemTemplate="{StaticResource CommentListDataTemplateLite}" ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"  SelectionChanged="commentsList_SelectionChanged" ItemsPanel="{StaticResource ItemsPanelTemplate1}"  ItemsSource="{Binding Comments}" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" />
                    <TextBox x:Name="tbReply" Text="{Binding CommentText, Mode=TwoWay}"  Margin="0,0,10,0" Grid.Row="1" Style="{StaticResource TextBoxStyle3}"/>
                </Grid>
            </controls:PivotItem>
            <controls:PivotItem x:Name="ocomment_item" Margin="0,14,0,0" >
                <controls:PivotItem.Header>
                    <TextBlock Margin="-10,40,0,0" Text="{Binding OriginalCommentText, Source={StaticResource AppResx}}" VerticalAlignment="Bottom"  FontSize="48" />
                </controls:PivotItem.Header>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <ListBox Margin="2,12,2,0" x:Name="ocommentsList" ItemTemplate="{StaticResource CommentListDataTemplateLite}" ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}"  SelectionChanged="ocommentsList_SelectionChanged" ItemsPanel="{StaticResource ItemsPanelTemplate1}"  ItemsSource="{Binding OriginalComments}" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" />
                    <!--<TextBlock Visibility="{Binding HasComments, Converter={StaticResource BoolToVisibilityConverter}}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="10"  Text="{Binding LoadingText, Mode=TwoWay}"  /> <CheckBox IsChecked="{Binding IsCommentAlso}" Content="{Binding RepostAndComment, Source={StaticResource AppResx}}"/>-->
                   
                    <TextBox x:Name="tbReplyToOriginal" Text="{Binding CommentTextToOriginal, Mode=TwoWay}"  Margin="0,0,10,0" Grid.Row="1" Style="{StaticResource TextBoxStyle3}"/>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>

    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <!--
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    -->
</phone:PhoneApplicationPage>
